﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Linq.Expressions;
using System.Text;
using System.Web.UI.WebControls;
using Pampa.CRUD.Configuration;
using Pampa.MVC.Fluent.Crud.Groups;

namespace Pampa.MVC.Fluent.Crud.Items
{
    public class TextItemBuilder<TGroup, TEditor> : EditItemBuilder<TGroup, TEditor, object, TextItemBuilder<TGroup, TEditor>>
    {
        private readonly TextItem _textItem;

        public TextItemBuilder(TextItem textItem) : base(textItem)
        {
            _textItem = textItem;
        }

        public TextItemBuilder(GroupBuilder<TGroup, TEditor> group, TextItem textItem) : base(group, textItem)
        {
            _textItem = textItem;
        }

        public TextItemBuilder<TGroup, TEditor> MaxLength(int maxLength)
        {
            _textItem.MaxLength = maxLength;
            return this;
        }

        public TextItemBuilder<TGroup, TEditor> Multiline(int valueHeight)
        {
            _textItem.TextMode = TextBoxMode.MultiLine;
            _textItem.ValueHeight = valueHeight;
            return this;
        }
    }
}
